
import java.io.IOException;
import javax.microedition.lcdui.Alert;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.List;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author Abahe
 */
public class ObjekWisataList extends List implements CommandListener {

    private BTIMidlet midlet;
    private Display display;
    private Image img;
    Command cmdPilih;
    Command cmdKembali;

    public ObjekWisataList(BTIMidlet midlet, Display display, String title) {
        super(title, IMPLICIT);

        this.midlet = midlet;
        this.display = display;

        cmdPilih = new Command("Pilih", Command.SCREEN, 2);
        cmdKembali = new Command("Kembali", Command.EXIT, 1);

        addCommand(cmdPilih);
        addCommand(cmdKembali);
        setCommandListener(this);
        try {
            img = Image.createImage("/icon_objek_wisata_off_128.png");
        } catch (IOException e) {
        }

        append("Kawah Ratu – Gunung Tangkuban Parahu", img);
        append("Kebun Binatang", img);
    }

    public void commandAction(Command c, Displayable d) {
        if (c == cmdKembali) {
            midlet.backToMenuCanvas();            
        } else {
            int indeks = getSelectedIndex();

            midlet.showObjekWisata(indeks);
        }
    }
}
